Skip to contentSkip to conversation

Change in openvpn[master]: Add support for Mbed TLS 4

Openvpn-devel In review MaxF (Code Review) 2 participants 22 messages Dec 12, 2025 – Jan 24 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1765571645000.Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email

to review the following change.

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

---
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

14 files changed, 2,448 insertions(+), 700 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1441/1

src/openvpn/Makefile.am +1 -0
index db87dfc..1caed27 100644
@@ -53,6 +53,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e95752a..39ae90a 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +673 -635

1,672 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +65 -50

174 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,131 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

148 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +67 -13

80 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +2 -0
index 8380a116..882a8e7 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 627ba92..de9f5f3 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index 4b4bcaa..cdf24c8 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +5 -0
index da98531..78d9ba0 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 1
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

Part of the diff is not shown here. View the raw message.

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email

to look at the new patch set (#2).

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

---
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

14 files changed, 2,450 insertions(+), 700 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1441/2

src/openvpn/Makefile.am +1 -0
index db87dfc..1caed27 100644
@@ -53,6 +53,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e95752a..39ae90a 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +673 -635

1,672 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +65 -50

174 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,131 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

148 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +67 -13

80 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +2 -0
index 8380a116..882a8e7 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 627ba92..de9f5f3 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index 4b4bcaa..cdf24c8 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index da98531..18222b0 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 2
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

Part of the diff is not shown here. View the raw message.

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email

to look at the new patch set (#3).

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

---
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

14 files changed, 2,452 insertions(+), 702 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1441/3

src/openvpn/Makefile.am +1 -0
index db87dfc..1caed27 100644
@@ -53,6 +53,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e95752a..39ae90a 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +673 -635

1,672 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +65 -50

174 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,131 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

148 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +67 -13

80 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +4 -2
index 8380a116..50ac865 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 627ba92..de9f5f3 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index 4b4bcaa..cdf24c8 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index da98531..18222b0 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 3
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

Part of the diff is not shown here. View the raw message.

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, plaisthos.

syzzer has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 3:

(5 comments)

Patchset:

PS3:
A few initials thoughts when glazing over part of the code.

File src/openvpn/crypto_mbedtls.c:

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/ddbc1422_631be2a6?usp=email :
PS3, Line 88: /* TODO: Complete the table. */
Consider copying the table from the private mbedtls header file, might save you some work. And complain with mbedtls that they broke a useful API...

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/35ed3edf_fa15f561?usp=email :
PS3, Line 204: return (int)cipher_info->key_bytes;
key_bytes is already int, right?

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/eaf36ed8_1b9ab022?usp=email :
PS3, Line 292: ALLOC_OBJ_CLEAR(ctx, cipher_ctx_t);
Good catch, adding the _CLEAR.

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/b63901cc_f7bfd9e1?usp=email :
PS3, Line 299: /* TODO: Log warning on errors? */
We can't handle the error here. If this errors out, looks to me like we are in an invalid state. Consider ASSERT()'in out if it fails.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 3
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Mon, 15 Dec 2025 16:00:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email

to look at the new patch set (#4).

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

---
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

14 files changed, 2,449 insertions(+), 702 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1441/4

src/openvpn/Makefile.am +1 -0
index db87dfc..1caed27 100644
@@ -53,6 +53,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e95752a..39ae90a 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +670 -635

1,669 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +65 -50

174 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,133 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

1 line not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +67 -13

80 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +4 -2
index 8380a116..50ac865 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 627ba92..de9f5f3 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index 4b4bcaa..cdf24c8 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index da98531..18222b0 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 4
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>

Part of the diff is not shown here. View the raw message.

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, syzzer.

MaxF has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 3:

(3 comments)

File src/openvpn/crypto_mbedtls.c:

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/31ee5c24_5c1a094c?usp=email :
PS3, Line 88: /* TODO: Complete the table. */

Quoted 1 line

Consider copying the table from the private mbedtls header file, might save you some work. […]

I looked at it and I'm not sure how much it helps. The new PSA_KEY_TYPE and PSA_ALG magic numbers don't seem to be in that table. I also don't know if legacy crypto defines like MBEDTLS_AES_C are externally visible.

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/26d91568_0d8c32b2?usp=email :
PS3, Line 204: return (int)cipher_info->key_bytes;

Quoted 1 line

key_bytes is already int, right?

Right

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/50b21610_ae2e0509?usp=email :
PS3, Line 299: /* TODO: Log warning on errors? */

Quoted 1 line

We can't handle the error here. If this errors out, looks to me like we are in an invalid state. […]

I added ASSERTs to this and similar functions.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 3
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Mon, 15 Dec 2025 16:42:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: syzzer <[email protected]...>

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, syzzer.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email

to look at the new patch set (#5).

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

---
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

14 files changed, 2,439 insertions(+), 702 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1441/5

src/openvpn/Makefile.am +1 -0
index db87dfc..1caed27 100644
@@ -53,6 +53,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e95752a..39ae90a 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +660 -635

1,659 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +65 -50

174 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,133 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

11 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +67 -13

80 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +4 -2
index 8380a116..50ac865 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 627ba92..de9f5f3 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index 4b4bcaa..cdf24c8 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index da98531..18222b0 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 5
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>

Part of the diff is not shown here. View the raw message.

#8 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, plaisthos, syzzer.

flichtenheld has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 5: Code-Review-2

(1 comment)

Patchset:

PS5:
I have added http://gerrit.openvpn.net/c/openvpn/+/1474 that updates the GHA definition to use mbedtls 4. But it has multiple failures (see https://github.com/flichtenheld/openvpn/actions/runs/21002319306/job/60375385060)

On Ubuntu 22.04 it builds but then fails in t_server_null.sh with

    2026-01-14 16:50:43 Mbed TLS 4 only supports pre-defined Diffie-Hellman groups.
    2026-01-14 16:50:43 Exiting due to fatal error

On Ubuntu 24.04 it doesn't build

```
  CC       ssl_mbedtls.o
ssl_mbedtls.c:607:1: error: unused function 'external_pkcs1_sign' [-Werror,-Wunused-function]
external_pkcs1_sign(void *ctx_voidptr, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,
^
ssl_mbedtls.c:703:1: error: unused function 'external_key_len' [-Werror,-Wunused-function]
external_key_len(void *vctx)
^
2 errors generated.
```

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 5
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Wed, 14 Jan 2026 16:56:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

#9 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, syzzer.

MaxF has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 5:

(1 comment)

Patchset:

PS5:

Quoted 1 line

I have added http://gerrit.openvpn. […]

The reason for the first error is what it says on the tin: Mbed TLS 4 just doesn't have a function to load Diffie-Hellman moduli from files. I don't know what to do about that. Should I make the error non-fatal, log a warning and ignore the dh file? Or maybe remove the dh option from the Mbed TLS build and then we can add "ignore-unknown-option dh" to the config?

I'll look into the 2nd point, but I don't think stock Mbed TLS 4 can support external signatures at all...

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 5
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 15 Jan 2026 15:56:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>

#10 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, plaisthos, syzzer.

flichtenheld has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 5:

(1 comment)

Patchset:

PS5:

Quoted 1 line

The reason for the first error is what it says on the tin: Mbed TLS 4 just doesn't have a function t […]

Good questions regarding --dh. Not sure what is the best solution. Maybe something to discuss in an IRC meeting?

Fix for the second failure should be trivial pre-processor fix. Just do not emit this code when it is unused.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 5
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Thu, 15 Jan 2026 17:44:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: MaxF <[email protected]...>

#11 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, syzzer.

plaisthos has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 5:

(1 comment)

File src/openvpn/ssl_mbedtls.c:

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/46ea0c7e_a2445a5e?usp=email :
PS5, Line 610: {
/Users/arne/oss/openvpn-git/src/openvpn/ssl_mbedtls.c:609:1: error: unused function 'external_pkcs1_sign' [-Werror,-Wunused-function]
609 | external_pkcs1_sign(void *ctx_voidptr, int (*f_rng)(void *, unsigned char *, size_t), void *p_rng,

And I do not see this function being used anywhere. Please double check this with Werror.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 5
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Wed, 21 Jan 2026 13:04:01 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

#12 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, syzzer.

plaisthos has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 5: Code-Review-1

(1 comment)

Patchset:

PS5:
There is something wrong with connecting to an OpenSSL based OpeNVPN, e.g. against community VPN:

sudo ./src/openvpn/openvpn --config ~/ovpn/confs/community.ovpn --script-security 2

Password:

2026-01-21 15:21:34 DEPRECATED OPTION: --persist-key option ignored. Keys are now always persisted across restarts.
2026-01-21 15:21:34 OpenVPN 2.7_rc5 [git:review/mbedtls4/2cc00e80bca26c1c+*] aarch64-apple-darwin25.2.0 [SSL (mbed TLS)] [LZO] [LZ4] [MH/RECVDA] [AEAD] built on Jan 21 2026
2026-01-21 15:21:34 library versions: mbed TLS 4.0.0, LZO 2.10
2026-01-21 15:21:34 TCP/UDP: Preserving recently used remote address: [AF_INET]3.69.106.84:1194
2026-01-21 15:21:34 Socket Buffers: R=[786896->786896] S=[9216->9216]
2026-01-21 15:21:34 UDPv4 link local: (not bound)
2026-01-21 15:21:34 UDPv4 link remote: [AF_INET]3.69.106.84:1194
2026-01-21 15:21:34 TLS: Initial packet from [AF_INET]3.69.106.84:1194, sid=709f8846 9d2eb04d
2026-01-21 15:21:34 VERIFY OK: depth=1, C=US, ST=CA, L=Pleasanton, O=openvpn.net, OU=My Organizational Unit, CN=ChangeMe, [email protected]...
2026-01-21 15:21:34 Validating certificate key usage
2026-01-21 15:21:34 VERIFY KU OK
2026-01-21 15:21:34 Validating certificate extended key usage
2026-01-21 15:21:34 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication
2026-01-21 15:21:34 NOTE: --mute triggered...
2026-01-21 15:21:34 2 variation(s) on previous 20 message(s) suppressed by --mute
2026-01-21 15:21:34 TLS_ERROR: read tls_read_plaintext error: SSL - * Received NewSessionTicket Post Handshake Message. This error code is experimental and may be changed or removed without notice
2026-01-21 15:21:34 TLS Error: TLS object -> incoming plaintext read error
2026-01-21 15:21:34 TLS Error: TLS handshake failed

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 5
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Wed, 21 Jan 2026 14:22:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

#13 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, syzzer.

flichtenheld has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 5: -Code-Review

(1 comment)

Patchset:

PS5:

Quoted 1 line

Good questions regarding --dh. Not sure what is the best solution. […]

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 5
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Wed, 21 Jan 2026 16:35:35 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: MaxF <[email protected]...>

#14 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, plaisthos, syzzer.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email

to look at the new patch set (#6).

The following approvals got outdated and were removed:
Code-Review-1 by plaisthos

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

---
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/t_server_null_default.rc
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

15 files changed, 2,442 insertions(+), 705 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1441/6

src/openvpn/Makefile.am +1 -0
index c879585..3c567aa 100644
@@ -54,6 +54,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e9fc2f3..5248614 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +661 -636

1,661 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +66 -51

176 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,133 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

7 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +67 -13

80 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +4 -2
index f744945..6b678b2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 2e22204..582e130 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index bf8f960..cb30fe5 100644

Lines of this file are not shown. View the raw message.

tests/t_server_null_default.rc +1 -1
index 798cfd0..bba77aa 100755

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index f898e89..1aa92e6 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 6
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>

Part of the diff is not shown here. View the raw message.

#15 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, syzzer.

MaxF has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 6:

(1 comment)

Patchset:

PS6:
I rebased onto master, removed the error when running with --dh none, and changed the options in test_server_null to --dh none in order to avoid the error, as discussed in yesterday's IRC meeting.

I still need to look at Arne's comment.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 6
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Comment-Date: Thu, 22 Jan 2026 14:19:58 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

#16 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, syzzer.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email

to look at the new patch set (#7).

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

---
M README.mbedtls
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/t_server_null_default.rc
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

16 files changed, 2,446 insertions(+), 708 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1441/7

README.mbedtls +2 -2
index fb30db1..b768687 100644
@@ -7,8 +7,8 @@
 	make
 	make install
 
-This version requires mbed TLS version >= 3.2.1. Versions >= 4.0.0 are not
-yet supported. Support for TLS 1.3 requires an Mbed TLS version >= 3.6.4.
+This version requires mbed TLS version >= 3.2.1. Support for TLS 1.3 requires
+an Mbed TLS version >= 3.6.4.
 
 *************************************************************************
 
src/openvpn/Makefile.am +1 -0
index c879585..3c567aa 100644
@@ -54,6 +54,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e9fc2f3..5248614 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +661 -636

1,661 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +66 -51

176 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,130 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

148 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +69 -14

83 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +4 -2
index f744945..6b678b2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 2e22204..582e130 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index bf8f960..cb30fe5 100644

Lines of this file are not shown. View the raw message.

tests/t_server_null_default.rc +1 -1
index 798cfd0..bba77aa 100755

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index f898e89..1aa92e6 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 7
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>

Part of the diff is not shown here. View the raw message.

#17 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, syzzer.

MaxF has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 7:

(3 comments)

Patchset:

PS5:

Quoted 1 line

There is something wrong with connecting to an OpenSSL based OpeNVPN, e.g. against community VPN: […]

After looking around a bit, I found that this error code isn't exactly an error, but it's meant to tell the application "there's a new session ticket, if you want to do anything with that" (see e.g. https://github.com/Mbed-TLS/mbedtls/issues/8749).

In 3.6 it used to be the case that you had to opt in to that by calling mbedtls_ssl_conf_tls13_enable_signal_new_session_tickets but that function seems to be gone. Disabling session tickets altogether with mbedtls_ssl_conf_session_tickets doesn't seem to do anything in TLS 1.3 either. I did a git grep on the mbedtls source, it doesn't seem to be checked at all in ssl_tls13.c.

So ultimately I decided to just treat this error code like WANT_READ or WANT_WRITE and keep running. With that change, I can connect an openvpn-mbedtls client to an openssl server, and ignoring the error doesn't seem to cause any problems.

Patchset:

PS6:
Fixed connecting an mbedtls client to an openssl server. Also updated README.mbedtls.

File src/openvpn/ssl_mbedtls.c:

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/9eb67876_ce448f68?usp=email :
PS5, Line 610: {

Quoted 1 line

/Users/arne/oss/openvpn-git/src/openvpn/ssl_mbedtls. […]

Fixed. The unused function is ifdefd out now.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 7
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Comment-Date: Thu, 22 Jan 2026 17:47:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>

#18 lore raw
In reply to a message not in the archive

Attention is currently required from: MaxF, syzzer.

plaisthos has posted comments on this change by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Patch Set 7: Code-Review+2

(2 comments)

File src/openvpn/crypto_mbedtls.c:

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/32a319ea_8293f4ed?usp=email :
PS7, Line 611: { "SHA256", PSA_ALG_SHA_256 },
We probably want to a few more of the common algorithms here in a follow up commit or in the next version of this commit. At least SHA384 and SHA512 are pretty common and SHA224 wouldn't hurt either.

#define PSA_ALG_SHA3_224 ((psa_algorithm_t) 0x02000010)
/** SHA3-256 */
#define PSA_ALG_SHA3_256 ((psa_algorithm_t) 0x02000011)
/** SHA3-384 */
#define PSA_ALG_SHA3_384 ((psa_algorithm_t) 0x02000012)
/** SHA3-512 */
#define PSA_ALG_SHA3_512 ((psa_algorithm_t) 0x02000013)

seem also good candidates to already add here to future proof it a bit.

File src/openvpn/ssl_mbedtls.c:

http://gerrit.openvpn.net/c/openvpn/+/1441/comment/3877c185_ffe25e3e?usp=email :
PS7, Line 362: { "X25519", MBEDTLS_SSL_IANA_TLS_GROUP_X25519 },
MBEDTLS_SSL_IANA_TLS_GROUP_X448 should also be added here I think.

Also secp521r1. For the european context in goverment stuff, often the brain pool curves are also used, so I am surprised they are missing here.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 7
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>
Gerrit-Attention: syzzer <[email protected]...>
Gerrit-Attention: MaxF <[email protected]...>
Gerrit-Comment-Date: Fri, 23 Jan 2026 13:33:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

#19 lore raw

PATCH v7 1/1 Add support for Mbed TLS 4

In reply to a message not in the archive

From: Max Fillinger <[email protected]...>

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1441
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1441
This mail reflects revision 7 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

README.mbedtls +2 -2
index fb30db1..b768687 100644
@@ -7,8 +7,8 @@
 	make
 	make install
 
-This version requires mbed TLS version >= 3.2.1. Versions >= 4.0.0 are not
-yet supported. Support for TLS 1.3 requires an Mbed TLS version >= 3.6.4.
+This version requires mbed TLS version >= 3.2.1. Support for TLS 1.3 requires
+an Mbed TLS version >= 3.6.4.
 
 *************************************************************************
 
src/openvpn/Makefile.am +1 -0
index c879585..3c567aa 100644
@@ -54,6 +54,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e9fc2f3..5248614 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +661 -636

1,661 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +66 -51

176 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,130 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

148 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +69 -14

83 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +4 -2
index f744945..6b678b2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 2e22204..582e130 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index bf8f960..cb30fe5 100644

Lines of this file are not shown. View the raw message.

tests/t_server_null_default.rc +1 -1
index 798cfd0..bba77aa 100755

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index f898e89..1aa92e6 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#20 lore raw

[Openvpn-devel] [PATCH applied] Re: Add support for Mbed TLS 4

This is quite a huge last-minute patch before a 2.7.0 release - but there are some special considerations. mbedTLS 3 will run out of support while we're very likely still in the 2.7.x maintenance phase, so having mbedTLS 4 support in 2.7.x is important for long-term supportability. Further, the patch only very lightly touches on "non mbedTLS" areas of the code - so most users will not be affected.

"git show --color-moved=zebra" shows that all the old code is still there, just goes to "mbedtls_legacy" - to avoid #ifdef orgys, and at some point dropping mbedTLS 3 will be easy.

Arne has tested this, and verified interoperability with OpenSSL-OpenVPN, and the buildbots + GHA have tested that mbedTLS 3 support still works.

Your patch has been applied to the master branch.

commit d0589909b9b6f4400429e010e9c4874b7f496e59

Author: Max Fillinger
Date:   Fri Jan 23 17:47:39 2026 +0100
     Add support for Mbed TLS 4

     Signed-off-by: Max Fillinger <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1441
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg35401.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#21 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#8) to the change originally created by MaxF. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1441
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35401.html

---
M README.mbedtls
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/t_server_null_default.rc
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

16 files changed, 2,442 insertions(+), 704 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/41/1441/8

README.mbedtls +2 -2
index fb30db1..b768687 100644
@@ -7,8 +7,8 @@
 	make
 	make install
 
-This version requires mbed TLS version >= 3.2.1. Versions >= 4.0.0 are not
-yet supported. Support for TLS 1.3 requires an Mbed TLS version >= 3.6.4.
+This version requires mbed TLS version >= 3.2.1. Support for TLS 1.3 requires
+an Mbed TLS version >= 3.6.4.
 
 *************************************************************************
 
src/openvpn/Makefile.am +1 -0
index c879585..3c567aa 100644
@@ -54,6 +54,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e9fc2f3..5248614 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +659 -634

1,651 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +64 -49

166 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,133 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

17 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +69 -14

83 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +4 -2
index f744945..6b678b2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 2e22204..582e130 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index bf8f960..cb30fe5 100644

Lines of this file are not shown. View the raw message.

tests/t_server_null_default.rc +1 -1
index 798cfd0..bba77aa 100755

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index 156e5a9..fb070aa 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 8
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>

Part of the diff is not shown here. View the raw message.

#22 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email )

Change subject: Add support for Mbed TLS 4
......................................................................

Add support for Mbed TLS 4

This commit adds support for Mbed TLS 4. This version comes with some drastic changes. The crypto library has been completely redesigned, so the contents of crypto_mbedtls.c are moved to crypto_mbedtls_legacy.c and crypto_mbedtls.c handles the crypto for version 4.

Mbed TLS 4 also removed the feature for looking up a crypto algorithm by name, so we need to translate algorithm names to Mbed TLS numbers in OpenVPN. The tables are not yet complete. For symmetric algorithms, I have added AES and Chacha-Poly which should be enough for most use cases.

Change-Id Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1441
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35401.html

---
M README.mbedtls
M src/openvpn/Makefile.am
M src/openvpn/crypto_backend.h
M src/openvpn/crypto_mbedtls.c
M src/openvpn/crypto_mbedtls.h
A src/openvpn/crypto_mbedtls_legacy.c
A src/openvpn/crypto_mbedtls_legacy.h
M src/openvpn/mbedtls_compat.h
M src/openvpn/ssl_mbedtls.c
M src/openvpn/ssl_mbedtls.h
M src/openvpn/ssl_verify_mbedtls.c
M src/openvpn/syshead.h
M tests/Makefile.am
M tests/t_server_null_default.rc
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_common.h

16 files changed, 2,442 insertions(+), 704 deletions(-)
README.mbedtls +2 -2
index fb30db1..b768687 100644
@@ -7,8 +7,8 @@
 	make
 	make install
 
-This version requires mbed TLS version >= 3.2.1. Versions >= 4.0.0 are not
-yet supported. Support for TLS 1.3 requires an Mbed TLS version >= 3.6.4.
+This version requires mbed TLS version >= 3.2.1. Support for TLS 1.3 requires
+an Mbed TLS version >= 3.6.4.
 
 *************************************************************************
 
src/openvpn/Makefile.am +1 -0
index c879585..3c567aa 100644
@@ -54,6 +54,7 @@
 	comp-lz4.c comp-lz4.h \
 	crypto.c crypto.h crypto_backend.h \
 	crypto_openssl.c crypto_openssl.h \
+	crypto_mbedtls_legacy.c crypto_mbedtls_legacy.h \
 	crypto_mbedtls.c crypto_mbedtls.h \
 	crypto_epoch.c crypto_epoch.h \
 	dco.c dco.h dco_internal.h \
src/openvpn/crypto_backend.h +7 -0
index e9fc2f3..5248614 100644
@@ -32,9 +32,16 @@
 #ifdef ENABLE_CRYPTO_OPENSSL
 #include "crypto_openssl.h"
 #endif
+
 #ifdef ENABLE_CRYPTO_MBEDTLS
+#include <mbedtls/version.h>
+#if MBEDTLS_VERSION_NUMBER < 0x04000000
+#include "crypto_mbedtls_legacy.h"
+#else
 #include "crypto_mbedtls.h"
 #endif
+#endif
+
 #include "basic.h"
 #include "buffer.h"
 
src/openvpn/crypto_mbedtls.c +659 -634

1,651 lines not on this page · raw message

src/openvpn/crypto_mbedtls.h +64 -49

166 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.c new file +1133 -0

1,133 lines not on this page · raw message

src/openvpn/crypto_mbedtls_legacy.h new file +148 -0

17 lines not on this page · raw message

src/openvpn/mbedtls_compat.h +182 -0

182 lines not on this page · raw message

src/openvpn/ssl_mbedtls.c +69 -14

83 lines not on this page · raw message

src/openvpn/ssl_mbedtls.h +4 -2
index f744945..6b678b2 100644

Lines of this file are not shown. View the raw message.

src/openvpn/ssl_verify_mbedtls.c +154 -2

156 lines not on this page · raw message

src/openvpn/syshead.h +3 -0
index 2e22204..582e130 100644

Lines of this file are not shown. View the raw message.

tests/Makefile.am +1 -0
index bf8f960..cb30fe5 100644

Lines of this file are not shown. View the raw message.

tests/t_server_null_default.rc +1 -1
index 798cfd0..bba77aa 100755

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/Makefile.am +7 -0
index 7aeea47..1128eb4 100644

Lines of this file are not shown. View the raw message.

tests/unit_tests/openvpn/test_common.h +7 -0
index 156e5a9..fb070aa 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1441?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib251d546d993b96ed3bd8cb9111bcc627cdb0fae
Gerrit-Change-Number: 1441
Gerrit-PatchSet: 8
Gerrit-Owner: MaxF <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: syzzer <[email protected]...>

Part of the diff is not shown here. View the raw message.